<?php

namespace IMooc;

/**
 * 装饰器：颜色
 */
class ColorDrawDecorator implements DrawDecorator
{
    protected string $color;

    function __construct($color = 'red')
    {
        $this->color = $color;
    }

    function beforeDraw(): void
    {
        echo "<div style='color: $this->color;'>";
    }

    function afterDraw(): void
    {
        echo "</div>";
    }
}